package com.whales.lms.rms.web.service;

import java.util.List;

import org.springframework.stereotype.Service;

import anyframe.common.Page;

import com.whales.lms.rms.web.model.AdminVO;
import com.whales.shared.service.GenericService;

@Service
public class AdminService extends GenericService<AdminVO,AdminVO> {
	@Override
	public Page getPageList(AdminVO vo) throws Exception {
		return super.getPageList("admin.getAdminList", vo, vo.getStart(), vo.getLimit());
	}
	
	@Override
	public AdminVO findInfo(AdminVO vo) throws Exception {
		return super.findInfo("admin.getAdminById", vo);
	}
	
	@Override
	public List<AdminVO> getList(AdminVO vo) throws Exception {
		return super.getList("admin.getAdminList",vo);
	}
	
	@Override
	public int create(AdminVO vo) throws Exception {
		return super.create("admin.createAdmin",vo);
	}
	
	@Override
	public int update(AdminVO vo) throws Exception {
		return super.update("admin.updateAdminById",vo);
	}
	
	@Override
	public int delete(AdminVO vo) throws Exception {
		for(int i=0; i < vo.getIds().length; i++){
			AdminVO removeVO = new AdminVO();
			removeVO.setId(vo.getIds()[i]);
			super.delete("admin.deleteAdminById",removeVO);
		}
		return super.delete(vo);
	}
}
